#联盟成员

from config.config  import host1_1
from lib.api.common import jsonformat
import copy,requests
class Member:
    #添加联盟城规院
    def memberAdd(self,payload1):
        payload=copy.copy(payload1)
        url=f'{host1_1}/member/add'
        res=requests.post(url,json=payload)
        return res.json()
    #获取联盟成员
    def getMember(self,payload1):
        payload = copy.copy(payload1)
        url = f'{host1_1}/member'
        res = requests.get(url,data=payload)
        return res.json()
    #查询所有联盟成员
    def memberFindAll(self, payload1):
        payload = copy.copy(payload1)
        url = f'{host1_1}/member/findAll'
        res = requests.post(url, data=payload)
        return res.json()
    #修改联盟成员状态（修改联盟成员状态0:禁用 1:启用）
    def memberUpdateStatus(self,payload1):
        payload = copy.copy(payload1)
        url = f'{host1_1}/member/updateStatus'
        res = requests.post(url, data=payload)
        return res.json()

if __name__ == '__main__':
    member=Member()
    '''添加联盟成员'''
    payload={"ip": "10.40.1.14","name": "tanhuitong"}
    res=member.memberAdd(payload)
    print(f'添加联盟成员结果：\n{res}')
    '''获取联盟成员'''
    # payload={"name":"test1","appId":"BC_MEMBER_test1","ip":"219.151.156.122"}
    # #payload={"name":"test1"}
    # res=member.getMember(payload)
    # print(f'get获取联盟成员结果：\n{jsonformat(res)}')
    # payload={"page":0,"pageSize":10,"name":"yuxinma1","ip":"10.60.1.21"}
    # res=member.memberFindAll(payload)
    # print(f'通过名称与ip查询联盟成员结果：\n{jsonformat(res)}')
    # payload = {"page": 0, "pageSize": 10, "name": "test"}
    # res = member.memberFindAll(payload)
    # print(f'通过名称查询联盟成员结果：\n{jsonformat(res)}')
    # '''修改联盟成员的状态'''
    # payload={"id":6,"status":1}
    # res=member.memberUpdateStatus(payload)
    # print(f'修改联盟成员状态结果：\n{jsonformat(res)}')
